package com.cardone.platform.configuration.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.configuration.dao.DictionaryTypeDao;
import com.cardone.platform.configuration.dto.DictionaryTypeDto;

/**
 * 字典类型服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class DictionaryTypeDefaultService implements DictionaryTypeService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, DictionaryTypeDto saveDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).saveByIdOrCode(mappedClass, saveDictionaryType);
	}
	
	@Override
	@Transactional
	public DictionaryTypeDto saveByIdOrCode(DictionaryTypeDto saveDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).saveByIdOrCode(DictionaryTypeDto.class, saveDictionaryType);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, DictionaryTypeDto findDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findByCodeOrId(mappedClass, findDictionaryType);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(DictionaryTypeDto readDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).readByCodeNqIdForCount(readDictionaryType);
	}
	
	@Override
	@Transactional
	public int insertByCode(DictionaryTypeDto insertDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).insertByCode(insertDictionaryType);
	}
	
	@Override
	@Transactional
	public int updateByCode(DictionaryTypeDto updateDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).updateByCode(updateDictionaryType);
	}

	@Override
	@Transactional
	public int deleteByIds(DictionaryTypeDto deleteDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).deleteByIds(deleteDictionaryType);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, DictionaryTypeDto findDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findById(mappedClass, findDictionaryType);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, DictionaryTypeDto findListDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findListByLikeCode(mappedClass, findListDictionaryType);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(DictionaryTypeDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, DictionaryTypeDto paginationDictionaryType) {
		return ContextHolder.getBean(DictionaryTypeDao.class).paginationByLikeCode(mappedClass, paginationDictionaryType);
	}
}